package com.epam.employeebase.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="ADDRESSES")
public class Address {
	private Long id;
	private City city;
	private String street;
	private int house;
	private int apartment;
	
	@Id
	@SequenceGenerator(sequenceName="ADDRESSES_SEQ", name = "addressGenerator")
	@GeneratedValue(generator="addressGenerator")
	@Column(name="ID")
	public Long getId() {
		return id;
	}
	
	public void setId(Long id){
		this.id = id;
	}
	
	@Column(name="APARTMENT")
	public int getApartment() {
		return apartment;
	}

	public void setApartment(int apartment) {
		this.apartment = apartment;
	}
	@Column(name="HOUSE")
	public int getHouse() {
		return house;
	}
	
	public void setHouse(int house) {
		this.house = house;
	}
	@Column(name="STREET")
	public String getStreet() {
		return street;
	}
	
	public void setStreet(String street) {
		this.street = street;
	}
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="city_id")
	public City getCity() {
		return city;
	}
	
	public void setCity(City city) {
		this.city = city;
	}
}
